package com.midea.ai.air.ui.home.fragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.midea.ai.air.R;
import com.midea.ai.air.common.BaseFragment;

import java.util.Random;

/**
 * Created by ouyangdi on 2016/4/22.
 * 用户配网提示Fragment
 */
public class AddDeviceNetTipFragment extends BaseFragment {
    public static final int STATUS_FAST_AC = 0;
    public static final int STATUS_FAST_OTHERS = 1;
    public static final int STATUS_AP_AC = 2;
    public static final int STATUS_AP_OTHERS = 3;

    private int mStatus; //连接状态
    private ImageView mIvIcon;
    private TextView mTvTip;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        mStatus = new Random().nextInt(4);
        View view = inflater.inflate(R.layout.fragment_add_device_net_tip, container, false);
        initViews(view);
        return view;
    }

    private void initViews(View view) {
        mIvIcon = (ImageView)view.findViewById(R.id.iv_network_tip);
        mTvTip = (TextView)view.findViewById(R.id.tv_network_tip);

        switch (mStatus) {
            case STATUS_FAST_AC:
                mTvTip.setText(getString(R.string.air_add_device_tip1));
                break;

            case STATUS_FAST_OTHERS:
                mTvTip.setText(getString(R.string.air_add_device_tip2));
                break;

            case STATUS_AP_AC:
                mTvTip.setText(getString(R.string.air_add_device_tip3));
                mIvIcon.setImageResource(R.drawable.air_add_device_wifi_ap);
                break;

            case STATUS_AP_OTHERS:
                mTvTip.setText(getString(R.string.air_add_device_tip4));
                mIvIcon.setImageResource(R.drawable.air_add_device_wifi_ap);
                break;
        }

    }

}
